﻿namespace CodingExercises._11_20;

public class StrictSum
{
    // 严格检查整数溢出的求和
    public static int Method(IEnumerable<int> numbers)
    {
        int total = 0;
        foreach (var item in numbers)
        {
            checked
            {
                total += item;
            }
        }
        return total;
    }
}